package com.yesep.learn.design.behavioral.visitor;

import java.util.*;

public class Zoo {
    private final List<IPet> pets = new ArrayList<>();

    // 当前访问者对每个节点进行访问
    public void action(IVisitor feederVisitor) {
        for (IPet pet : pets) {
            pet.accept(feederVisitor);
        }
    }

    public void add(IPet pet) {
        pets.add(pet);
    }
}
